package com.see51.sdk.java;

import android.util.Log;

import com.sinaapp.bashell.VoAACEncoder;

/**
 * Created by saint on 2019/2/25.
 */
//pcm 编码成 aac 16k 16bit；
public class See51PcmToAac
{
    VoAACEncoder voAACEncoder;
    public See51PcmToAac()
    {
        voAACEncoder = new VoAACEncoder();
        int ii =voAACEncoder.Init(16000, 16000, (short) 1, (short) 1);// 采样率:16000,bitRate:32k,声道数:1，编码:0.raw
        Log.d(" voAACEncoder:","pcm"+ ii );
    }

    public  byte[] OnPcmToAac(byte[] pcmbuffer)
    {
        if(pcmbuffer.length<1)
            return null;
        Log.d("pcm","pcm"+ pcmbuffer.length);

        byte[] ret = voAACEncoder.Enc(pcmbuffer);
        if (ret!=null&&ret.length>0) {

          return  ret;
        }else{
           return null;
        }
    }
}
